﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.CF.Base;
using WoChu.RfClient.Entity;
using WoChu.RfClient.Duty.IFace;

namespace WoChu.RfClient.Duty
{
    public class LocationGoodsInventoryInfoUIRule
    {

        private static LocationGoodsInventoryInfoUIRule _NewInstance = new LocationGoodsInventoryInfoUIRule();

        public static LocationGoodsInventoryInfoUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new LocationGoodsInventoryInfoUIRule();
                }

                return _NewInstance;
            }
        }

        /// <summary>
        /// 获取商品货位库存
        /// </summary>
        /// <param name="locationCode"></param>
        /// <returns></returns>
        public List<LocationGoodsInventoryInfo> GetLocationGoods(string code)
        {
            try
            {
                List<LocationGoodsInventoryInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoodsInventoryInfo>.NewInstance.InvokeWebMethod<List<LocationGoodsInventoryInfo>>("GetLocationGoods", new object[] { code });
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        /// <summary>
        /// 获取商品货位库存
        /// </summary>
        /// <param name="locationCode"></param>
        /// <returns></returns>
        public List<LocationGoodsInventoryInfo> GetLocationGoodsByCode(string code)
        {
            try
            {
                List<LocationGoodsInventoryInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoodsInventoryInfo>.NewInstance.InvokeWebMethod<List<LocationGoodsInventoryInfo>>("GetLocationGoodsByCode", new object[] { code });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        /// <summary>
        /// 获取商品货位库存
        /// </summary>
        /// <param name="locationCode"></param>
        /// <returns></returns>
        public List<LocationGoodsInventoryDetail> GetLocationGoodsByGoodsId(string goodsId)
        {
            try
            {
                List<LocationGoodsInventoryDetail> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoodsInventoryInfo>.NewInstance.InvokeWebMethod<List<LocationGoodsInventoryDetail>>("GetLocationGoodsByGoodsId", new object[] { goodsId });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
    }

}
